<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/16
 * Time: 17:59
 */

namespace App\Http\Controllers;

use App\Models\UserBase;
use App\Transformers\UserGroupTransformer;
use App\Transformers\UserTransformer;
use Illuminate\Http\Request;

class UserInfoController extends ApiController
{
    /**
     * @var \Illuminate\Http\Request
     */
    protected $request;


    public function __construct(Request $request)
    {
        parent::__construct();
        $this->request = $request;
    }


    public function getUserInfo()
    {
        $this->validate($this->request, [
            'account' => 'required|integer',
        ]);

        $account = $this->request->input('account');
        $user = UserBase::where('account',$account)
            ->first();

        return $this->item($user,new UserTransformer());
    }
}